﻿using UnityEngine;
using System.Collections;

public class EnemyTrigger : MonoBehaviour {

	public float delay = 0.6f;
	private float timer;

	public bool canShoot = false;
	public Transform player;



	void Start () {
		timer = delay;
	}


	void Update () {

		timer -= Time.deltaTime;
		if(timer <= 0f && canShoot){
			print ("Shoot");
		}
	}


	private void OnTriggerEnter2D(Collider2D collider){
		if(collider.tag.Equals("Player")){
			canShoot = true;
		}
	}


	private void OnTriggerExit2D(Collider2D collider){
		if(collider.tag.Equals("Player")){
			canShoot = false;
		}
	}
}
